package com.zqh.productimgquery.controller;

import com.zqh.myfmmall.result.Result;
import com.zqh.productimgquery.service.ProductImgQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description :
 * @Author :kono淇杭哒、
 * @Create 2022-02-18 2:15
 */
@RestController
@RequestMapping("productImg")
public class ProductImgQueryController{
    @Autowired
    private ProductImgQueryService productImgQueryService;

    @GetMapping("getMainImg/{productId}")
    public Result getMainImg(@PathVariable("productId") String productId){
        return productImgQueryService.getMainImgUrlByProductId(productId);
    }

    @GetMapping("retrieve/{productId}")
    public Result retrieve(@PathVariable("productId") String productId){
        return productImgQueryService.retrieveByProductId(productId);
    }

    @PostMapping("getMainImgs")
    public Result getMainImgs(@RequestBody List<String> productIds){
        return productImgQueryService.getMainImgUrlByProductIds(productIds);
    }
}
